<script setup>
//导入自定义的存储对象函数
import {useCounterStore} from "@/stores/counter.js";
import {onMounted} from "vue";
//获取存储对象
const counterStore = useCounterStore()

onMounted(()=>{
  counterStore.getList()
})
</script>

<template>
  <el-button type="primary" @click="counterStore.increment">{{counterStore.count}}</el-button>
  <p>{{counterStore.doubleCount}}</p>
  <ul>
    <li v-for="item in counterStore.list" :key="item.id">
      {{item.name}}
    </li>
  </ul>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
